<template>

   <div class="goods-item" @click="itemclick">

<!--  <img v-lazy="" alt="" @load="imgload">-->
<img :src="'/api/'+gooditem.default_image_url">
    <div class="goods-info">
     <div class="itemname"> <p>{{gooditem.name}}</p></div>
     <span class="similar-product-price" >¥ <span class="price">{{gooditem.price}}</span></span>
      <span class="pay_count">{{gooditem.sales}}人付款</span>
<!--      <span class="collect"></span>-->
<!--            <p>123</p>-->
<!--      <span class="price">55</span>-->
<!--      <span class="collect">22</span>-->
    </div>
  </div>
</template>

<script>
export default {
name: "GoodItem",
  props:{
  gooditem:{
    type:Object,
    default(){
      return{}
    }
  }
  },
  computed:{
  // showimage(){return this.gooditem.image || this.gooditem.show.img}
  },
  methods:{
  imgload(){
    // this.$bus.$emit('aaa')

    }
  ,
    itemclick(){
      this.$router.push('/detail/'+this.gooditem.id)
      // console.log(this.gooditem.id)
      // console.log(111)
    }
  }
}
</script>

<style scoped>
  .goods-item {
    padding-bottom: 56px;
    position: relative;

    width: 48%;
  }

  .goods-item img {
    width: 100%;
    border-radius: 5px;
  }

  .goods-info {
    font-size: 12px;
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    overflow: hidden;
    text-align: center;
  }

  .goods-info p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
  }

  .goods-info .price {
    /*color: var(--color-high-text);*/
    font-weight: 400!important;

  }

  .goods-info .collect {
    position: relative;
  }

  .goods-info .collect::before {
    content: '';
    position: absolute;
    left: -15px;
    top: -1px;
    width: 14px;
    height: 14px;
    background: url("../../../assets/img/common/collect.svg") 0 0/14px 14px;
  }
  .itemname{
        box-sizing: border-box;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
    color: #1a1a1a;
    margin-top: 5px;
    line-height: 16px;
    margin-bottom: 3px;
    padding: 0 4px;
  }
  .similar-product-price{
color: #fa2c19;
display: inline-block;
padding: 0 5px 0 4px;
position: relative;
top: -1px;
height: 25px;
line-height: 25px;
font-family: Arial;
left: -31px;
  }
.pay_count{

  font-size: 10px;
margin-right: -1px;
padding-right: 10px;
left: 7px;
position: relative;
left: -32px;
top: -1px;
}

</style>
